<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>随机取数排序</title>
</head>
<body>
    

    <script>
        

        function randomNum(n) {
            var ary = [];
            var obj = {};
            for(var i=0;i<n;i++){
                var randomNum = Math.floor(Math.random()*(100-10))+10;
                if(typeof obj[randomNum] != 'undefined'){
                    i --;
                    continue;
                }
                obj[randomNum] = randomNum;
                ary.push(randomNum);
            }
            return ary;
            obj = null;
        }
    
        //console.log(randomNum(10));
        var arr = randomNum(10);
        arr.sort(function (a,b) {
            return a-b;
        });
        console.log(arr);

        function sum (arr) {
            return eval(arr.join('+'));
        }

        
        function delThree (a,b) {
            var ary = a.concat(b);
            ary.splice(3,1);
            return ary;
        }

        console.log(delThree([1,2],[3,4]));
        
    </script>
</body>
</html>